package littlewhisker.components.gallery {
	import littlewhisker.communication.DelayedCall;
	import littlewhisker.components.AbstractComponent;
	import flash.events.Event;	
	import caurina.transitions.Tweener;
	import flash.display.Sprite;

	/**
	 * @author Philip
	 */
	public class CarouselGalleryItem extends AbstractComponent {
		
		private var _galleryWidth:Number;
		private var _galleryHeight:Number;
		private var _position:int;
		private var _separation:Number;
		private var _index:uint;
		private var angle:Number;
		
		public function get index() : uint {
			return _index;
		}
		
		public function set index(index : uint) : void {
			_index = index;
			angle = getAngle();
		}
		
		public function get separation() : Number {
			return _separation;
		}
		
		public function set separation(separation : Number) : void {
			_separation = separation;
		}
		
		public function get position() : int {
			return _position;
		}
		
		public function set position(position : int) : void {
			_position = position;
		}
		
		public function get galleryWidth() : Number {
			return _galleryWidth;
		}
		
		public function set galleryWidth(galleryWidth : Number) : void {
			_galleryWidth = galleryWidth;
		}
		
		public function get galleryHeight() : Number {
			return _galleryHeight;
		}
		
		public function set galleryHeight(galleryHeight : Number) : void {
			_galleryHeight = galleryHeight;
		}
		
		public function CarouselGalleryItem(asset:Sprite = null):void{
			this.asset = asset;
		}
		
		public function moveTo( newAngle:Number ):void{
			
		}
		
		
		public function setToPosition():void{			
			var radAngle:Number = angle*Math.PI/180;
			asset.x = Math.cos(radAngle)*galleryWidth;
			asset.y = Math.sin(radAngle)*galleryHeight;
		}
		
		private function getAngle():Number {
			var newAngle:Number = position * separation;
			return newAngle;
		}
		
	}
}
